package com.kinyx.framework.log.test;

import org.junit.Before;
import org.junit.Test;

import com.kinyx.framework.log.Log;
import com.kinyx.framework.log.LogLevel;
import com.kinyx.framework.log.Logger;

public class KLogLevelTester {

	private void doTest() {
		System.out.println("level " + this.className + ": " + Logger.getLevel(this.className));
		final Log logger = Logger.getLog(this.getClass());
		logger.trace("trace");
		logger.debug("debug");
		logger.info("info");
		logger.warn("warn");
		logger.error("error");
		logger.fatal("fatal");
	}

	private String className;

	@Before
	public void before() {
		this.className = this.getClass().getName();
	}

	@Test
	public void testDefaultLevel() {
		System.out.println();
		System.out.println("日志级别");
		this.doTest();
	}

	@Test
	public void testResetedLevel() {
		System.out.println();
		System.out.println("动态修改日志级别");
		Logger.setLevel(this.className, LogLevel.fatal);
		this.doTest();
	}

}
